package xin.zhiyin.仓库.书;

import jakarta.transaction.Transactional;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import xin.zhiyin.实体.书Entity;

import java.util.List;

public interface 书Repository extends JpaRepositoryImplementation<书Entity,Long> {
    List<书Entity> findByCategoryId(Long categoryId);
    /**
     * 批量删除
     * 注意更新和删除是需要加事务的， 并且要加上 @Modify的注解
     * @function 自定义JPQL
     * @param ids
     */
    @Modifying
    @Transactional
    @Query("delete from 书Entity s where s.id in (?1)")
    void 批量删除(List ids);

}
